{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import tkinter as tk"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "window = tk.Tk()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "''"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "window.title(\"my_window\")\n",
    "window.geometry(\"200x200\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "e = tk.Entry(window, show=\"♂\", font=(\"黑体\", 10))\n",
    "e.pack()\n",
    "\n",
    "def insert_point():\n",
    "    var = e.get()\n",
    "    t.insert(\"insert\", var)\n",
    "\n",
    "def insert_end():\n",
    "    var = e.get()\n",
    "    t.insert(\"end\", var)\n",
    "    \n",
    "b1 = tk.Button(window, text=\"insert point\", width=15, \n",
    "              height=2, font=(\"consolas\", 10), command=insert_point)\n",
    "b1.pack()\n",
    "\n",
    "b2 = tk.Button(window, text=\"end point\", width=15, \n",
    "              height=2, font=(\"consolas\",10), command=insert_end)\n",
    "b2.pack()\n",
    "\n",
    "t = tk.Text(window, height=2, font=(\"黑体\", 10))\n",
    "t.pack()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "window.mainloop()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
